import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lib_util/lib_util.dart';

import '../../../module_common/utils/colors.dart';
import '../../../module_common/widgets/button/bottom_button.dart';
import '../../../module_common/widgets/header/page_header.dart';
import '../widgets/sheet/wallet_export_privatekey_sheet.dart';

//导出私钥页面
class WalletExportPrivateKey extends StatefulWidget {
  const WalletExportPrivateKey({Key? key}) : super(key: key);

  @override
  _WalletExportPrivateKeyState createState() => _WalletExportPrivateKeyState();
}

class _WalletExportPrivateKeyState extends State<WalletExportPrivateKey> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        appBar: PageHeaderCom(
          title: '',
        ),
        body: SingleChildScrollView(
          child: Container(
            padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Column(
              children: [
                SizedBox(
                  height: 40.w,
                ),
                Center(
                  child: Image(
                    image: AssetImage('assets/images/wallet/mnemonic_tips.png'),
                    height: 139.w,
                    width: 195.w,
                  ),
                ),
                SizedBox(
                  height: 21.w,
                ),
                Container(
                  padding: EdgeInsets.only(top: 10, bottom: 15, left: 15),
                  decoration: BoxDecoration(color: AppColors.c_FFF8F1, borderRadius: BorderRadius.circular(10)),
                  child: Row(
                    children: [
                      Image(
                        image: AssetImage('assets/images/dapp/warn.png'),
                        width: 20.w,
                        height: 20.w,
                      ),
                      SizedBox(
                        width: 10.w,
                      ),
                      Expanded(
                        child: Text(
                          'Important Tips: lf others obtain your private key they can control your assets',
                          style: TextStyle(fontSize: 12.sp, color: AppColors.c_FF5100),
                        ),
                      )
                    ],
                  ),
                ),
                SizedBox(
                  height: 20.w,
                ),
                Wrap(
                  children: [
                    Text(
                      'Back up private key to protect wallet security',
                      style: TextStyle(fontSize: 16.sp, color: AppColors.c_333333),
                    ),
                  ],
                ),
                SizedBox(
                  height: 10.w,
                ),
                Wrap(
                  children: [
                    Text(
                      'The private key is the credentials to restore your wallet and is only saved on your device. please make a backup copy and keep it safe!',
                      style: TextStyle(fontSize: 12.sp, color: AppColors.c_868391),
                    ),
                  ],
                ),
                SizedBox(
                  height: 15.w,
                ),
                Wrap(
                  children: [
                    Align(
                      alignment: Alignment.centerLeft,
                      child: Text(
                        'Suggested backup methods',
                        style: TextStyle(fontSize: 16.sp, color: AppColors.c_333333),
                      ),
                    ),
                  ],
                ),
                SizedBox(
                  height: 10.w,
                ),
                Container(
                  padding: EdgeInsets.all(15.w),
                  decoration: BoxDecoration(color: AppColors.c_F6F6F6, borderRadius: BorderRadius.circular(10)),
                  child: Column(
                    children: [
                      Row(
                        children: [
                          Image(
                            image: AssetImage('assets/images/dapp/success.png'),
                            width: 20.w,
                            height: 20.w,
                          ),
                          SizedBox(
                            width: 10.w,
                          ),
                          Expanded(
                              child: Text(
                            'Using pen and paper, write private key correctly in order',
                            style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w400, color: AppColors.c_868391),
                          ))
                        ],
                      ),
                      SizedBox(
                        height: 10.w,
                      ),
                      Row(
                        children: [
                          Image(
                            image: AssetImage('assets/images/dapp/success.png'),
                            width: 20.w,
                            height: 20.w,
                          ),
                          SizedBox(
                            width: 10.w,
                          ),
                          Expanded(
                              child: Text(
                            'Keep private key in a safe place',
                            style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w400, color: AppColors.c_868391),
                          ))
                        ],
                      ),
                      SizedBox(
                        height: 10.w,
                      ),
                      Row(
                        children: [
                          Image(
                            image: AssetImage('assets/images/dapp/error.png'),
                            width: 20.w,
                            height: 20.w,
                          ),
                          SizedBox(
                            width: 10.w,
                          ),
                          Expanded(
                              child: Text(
                            'Do not save or send private key on the Internet',
                            style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w400, color: AppColors.c_868391),
                          ))
                        ],
                      ),
                    ],
                  ),
                ),
                SizedBox(
                  height: 100.w,
                )
              ],
            ),
          ),
        ),
        bottomNavigationBar: bottomControl());
  }

  Widget bottomControl() {
    return Padding(
        padding: EdgeInsets.fromLTRB(20, 0, 20, MediaQuery.of(context).padding.bottom + 11),
        child: BottomBtn(
          textList: ['Confirm'],
          onConfirm: () {
            Utils.showBottomSheetDialog(context, ExportPrivateKeySheet());
          },
        ));
  }
}
